from rest_framework import serializers
from apps.models import HouseKeeping


class HouseKeepingSerializer(serializers.ModelSerializer):
    class Meta:
        model = HouseKeeping

        # 排除字段
        # exclude = ('wish', 'collect',)
        fields = ["id", 'title', 'cover', 'price', 'mobile', 'age', 'sex', 'location', 'description','status','user']

        extra_kwargs = {
            "mobile": {"max_length": 11, "min_length": 11}
        }

    
    # def _get_user(self, attrs):
    #     pass
    
    # def validate(self, attrs):
    #     user = self._get_user(attrs)
    #     return super().validate(attrs)
    
    

